package belf.migrate.evaluate.model;

import lombok.Data;

/**
 * 评估兼容信息
 */
@Data
public class EvaluateSinkResult {

    /**
     * 兼容条数
     */
    private int compatibleSize;

    /**
     * 转换条数
     */
    private int convertSize;

    /**
     * 不兼容条数
     */
    private int unCompatibleSize;

    /**
     * 未知条数
     */
    private int unKnownSize;

    /**
     * 兼容率
     */
    private double compatiblePercent;

    /**
     * 转换率
     */
    private double convertPercent;

    /**
     * 不兼容率
     */
    private double unCompatiblePercent;

    /**
     * 兼容状态
     */
    private String compatibleStatue;

    public void addCompatibleSize(int allObjects) {
        this.compatibleSize++;
        this.compatiblePercent =  allObjects == 0 ? 1 : (double)compatibleSize / allObjects;
    }

    public void addConvertSize(int allObjects) {
        this.convertSize++;
        this.convertPercent =  allObjects == 0 ? 1 : (double)convertSize / allObjects;
    }

    public void addUnCompatibleSize(int allObjects) {
        this.unCompatibleSize++;
        this.convertPercent =  allObjects == 0 ? 1 : (double)unCompatibleSize / allObjects;
    }

    public void addUnKnownSize(int allObjects) {
        this.unKnownSize++;
    }

    public void addCompatibleSizeByCount(int count, int allObjects) {
        this.compatibleSize += count;
        this.compatiblePercent =  allObjects == 0 ? 1 : (double)compatibleSize / allObjects;
    }

    public void addConvertSizeByCount(int count, int allObjects) {
        this.convertSize += count;
        this.convertPercent =  allObjects == 0 ? 1 : (double)convertSize / allObjects;
    }

    public void addUnCompatibleSizeByCount(int count, int allObjects) {
        this.unCompatibleSize += count;
        this.convertPercent =  allObjects == 0 ? 1 : (double)unCompatibleSize / allObjects;
    }

    public void addUnKnownSizeByCount(int count, int allObjects) {
        this.unKnownSize += count;
        this.convertPercent =  allObjects == 0 ? 1 : (double)unKnownSize / allObjects;
    }

}
